import java.io.InputStream; 
import java.io.OutputStream; 
public class VyattaTerminalOutput 
{ 
	 InputStream input= null; 
	 OutputStream output = null; 
	 StringBuffer strbuff = new StringBuffer(); 
	 public StringBuffer getStrbuff() 
	 { 
		 return this.strbuff; 
	 } 
	 public void setStrbuff(StringBuffer strbuff) 
	 { 
		 this.strbuff = strbuff; 
	 } 
	 public VyattaTerminalOutput(InputStream in,OutputStream out)
	 { 
		 Receive rec = new Receive(); 
		 this.input = in; 
		 this.output = out; 
		 rec.start(); 
	} 
	public InputStream getInput() 
	{ 
		return input; 
	} 
	public void setInput(InputStream input) 
	{ 
		this.input = input; 
	} 
	public OutputStream getOutput() 
	{ 
		return output; 
	} 
	public void setOutput(OutputStream output) 
	{ 
		this.output = output; 
	} 
	public boolean bufferSize(int oldbuff,int  newbuff)
	{
		if(oldbuff<newbuff)
		{
			return (true);
		}
		else
		{
			return false;
		}
	}
	class Receive extends Thread 
	{ 
		public void run() 		
			 { 
				 try 
				 { 
				      while(true) 
				      { 
							 byte[] bt = new byte[4096];							
							 if(input.available() > 0) 
							 { 
								 int i=input.read(bt, 0, 2096); 
		         	       		 if(i<0) 
		         	       		 break; 
		         	       		 strbuff.append(new String(bt)); 
		         	       		 try 
		         	       		 { 
		         	       			Thread.sleep(1000); 
		         	       		 } 
		         	       		 catch(Exception e) 
		         	       		 { 
		         	       			 e.printStackTrace(); 
		         	       		 } 
							 } 
				      } 
				 }
				 catch(Exception e) 
				 { 
					 System.out.println(e); 
				 } 
			 } 
		 } 
	}